import 'package:flutter/material.dart';

class Widget_FractionallySizedBox_Page extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text("FractionallySizedBox"),
          ),
          body: Container(
            width: 100.0,
            height: 100.0,
            color: Colors.blue,
            child: FractionallySizedBox(
              widthFactor: 0.5,
              heightFactor: 1.5,
              child: Container(
                width: 100.0,
                height: 100.0,
                color: Colors.red,
              ),
            ),
          )
      ),
    );
  }
}

/**
 * 百分比布局，SizeBox直接通过width，height限制子控件；FractionallySizedBox通过百分比限制
 * const FractionallySizedBox({
    Key key,
    this.alignment = Alignment.center,
    this.widthFactor,//宽度因子，乘以宽度就是组件最后的宽
    this.heightFactor,
    Widget child,
    })
 */
